export const sendMessage = async (message) => {
  const response = await fetch('/api/chat', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      message,
      history: []
    })
  })

  if (!response.ok) {
    throw new Error('Network response was not ok')
  }

  return new EventSource('/api/chat')
}

export const uploadDocument = (file) => {
  const formData = new FormData()
  formData.append('file', file)
  return api.post('/documents/upload', formData)
} 